/*
 * @Author: guandeshen 295570679@qq.com
 * @Date: 2024-05-19 12:23:55
 * @LastEditors: guandeshen 295570679@qq.com
 * @LastEditTime: 2024-09-04 21:46:10
 * @FilePath: /task-admin/src/api/task/index.ts
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
import request from "@/utils/request";
import {
  TaskList,
  TaskQuery,
  TaskForm,
  GroupleaderQuery,
  GroupleaderList,
  WBSQuery,
  WBSList,
  TaskInfoQuery,
  TaskInfo,
  AssetsQuery,
  AssetsList,
  StakeholderQuery,
  StakeholderList,
  detailQuery,
} from "./model";

class TaskAPI {
  /**
   * 获取任务分页列表
   *
   * @data data
   */
  static getPage(data: TaskQuery) {
    return request<any, PageResult<TaskList[]>>({
      url: "/tenant/task/index",
      method: "post",
      data: data,
    });
  }

  /**
   * 获取任务分页列表
   *
   * @data data
   */

  static add(data: TaskForm) {
    return request({
      url: "/tenant/task/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 详情
   *
   * @data data
   */

  static detail(data: detailQuery) {
    return request<any, TaskForm>({
      url: "/tenant/task/info",
      method: "post",
      data: data,
    });
  }

  /**
   * 获取组长分页列表
   *
   * @data data
   */
  static getGroupleader(data: GroupleaderQuery) {
    return request<any, PageResult<GroupleaderList[]>>({
      url: "/tenant/user/groupleader",
      method: "post",
      data: data,
    });
  }

  /**
   * 筛选WBS列表
   *
   * @data data
   */
  // static getWBS(data: WBSQuery) {
  //   return request<any, PageResult<WBSList[]>>({
  //     url: "/tenant/task/wbs",
  //     method: "post",
  //     data: data,
  //   });
  // }
  static getWBS(data: WBSQuery) {
    return request<any, PageResult<WBSList[]>>({
      url: "/tenant/wbs/index",
      method: "post",
      data: data,
    });
  }

  /**
   * 获取任务详情
   *
   * @data data
   */
  static getTaskInfo(data: TaskInfoQuery) {
    return request<any, TaskInfo>({
      url: "/tenant/task/info",
      method: "post",
      data: data,
    });
  }

  /**
   * 资产列表分页列表
   *
   * @data data
   */
  static getAssets(data: AssetsQuery) {
    return request<any, PageResult<AssetsList[]>>({
      url: "/tenant/task/assets",
      method: "post",
      data: data,
    });
  }

  /**
   * 联系人列表分页列表
   *
   * @data data
   */
  static getStakeholder(data: StakeholderQuery) {
    return request<any, PageResult<StakeholderList[]>>({
      url: "/tenant/task/stakeholder",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除
   *
   * @data data
   */
  static deleteByIds(data: Ids) {
    return request({
      url: "/tenant/task/del",
      method: "post",
      data: data,
    });
  }
}

export default TaskAPI;
